package com.topnav.mc.listener.bean;

/**
 * 升级失败原因
 * @Author: kenny
 * @Date: 2023/11/11 11:49
 */
public enum EUpgradeFaileReasion {
    //01：固件下载超时；02：升级包损坏；03：系统异常；04：下载固件中断；05：电量不足；	06：用户强制关机；99：其他。

    REASION01(1,"固件下载超时"),
    REASION02(2,"升级包损坏"),
    REASION03(3,"系统异常"),
    REASION04(5,"下载固件中断"),
    REASION05(5,"电量不足"),
    REASION06(6,"用户强制关机"),
    REASION99(99,"其他");

    private int code;
    private String desc;

    private EUpgradeFaileReasion(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {return code;}

    public void setCode(int code) {this.code = code;	}

    public String getDesc() {return desc;}

    public void setDesc(String desc) {this.desc = desc;}

    public static EUpgradeFaileReasion getByCode(int code) {
        for(EUpgradeFaileReasion upgradeFaileReasion : EUpgradeFaileReasion.values()){
            if (upgradeFaileReasion.getCode() == code){
                return upgradeFaileReasion;
            }
        }
        return null;
    }

}
